package com.backend.struts;

import com.backend.models.Product;
import lombok.Data;
import org.apache.http.client.utils.DateUtils;

import java.io.Serializable;

@Data
public class ProductObj implements Serializable {
    public Integer id;
    public Integer userId;
    public GlobalDefine.PRODUCT_STATUS status;
    public Double price;
    public Double buyPrice;//购买价格
    public Double expressFee;//快递费用
    public String showImg; // 展示图
    public String title;
    public String createTime;

    public ProductObj() {
    }

    public ProductObj(Product product) {
        if(product == null){
            return;
        }
        this.id = product.id;
        this.userId = product.userId;
        this.status = product.status;
        this.price = product.price;
        this.buyPrice = product.buyPrice;
        this.expressFee = product.expressFee;
        this.showImg = product.showImg;
        this.title = product.title;
        this.createTime = DateUtils.formatDate(product.createTime,"yyyy-MM-dd hh:mm:ss");
    }
}
